﻿
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutFront.cshtml";
}
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" type="text/css" href="/lib/layui/css/layui.css" />
        <script src="/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    </head>
<aside>
    <div class="l_box">
        <div class="about_me">
            @Html.Action("MyAbout", "PartialView")
        </div>
        <div class="wdxc">
            @Html.Action("MyGallery", "PartialView")
        </div>
        <div class="guanzhu">
            <h2>关注我 么么哒</h2>
            <ul>
                <img src="~/images/wx.jpg">
            </ul>
        </div>
    </div>
</aside>
<div class="r_box">
    <div class="about">
        <form class="layui-form" id="fromMessage" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">姓名：</label>
                <div class="layui-input-block">
                    <input type="text" name="Name" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">留言内容：</label>
                <div class="layui-input-block">
                    <textarea name="Cont" placeholder="请输入留言内容" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    <button type="reset" id="btnReset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
        <script>
            //Demo
            layui.use('form', function () {
                var form = layui.form;
                var $ = layui.$;
                //监听提交
                form.on('submit(formDemo)', function (data) {
                    var str = $("#fromMessage").serialize();
                    $.post("/Message/SaveMessage", str, function (re) {
                        if (re > 0) {
                            $("#btnReset").click();//调用重置按钮单击事件
                            layer.msg("留言成功");
                        } else {
                            layer.msg("留言失败");
                        }
                    }, "text")
                    return false;
                });
            });
        </script>
    </div>
</div>


